from jrcmodel.models import CST, MyConstants
from django.utils import simplejson
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.views.decorators.csrf import csrf_exempt


def get_csts(request):
    qs = CST.objects.all()
#    return HttpResponse(simplejson.dumps(qs[0]))
    return render_to_response("ajax/getcsts.html", {"csts": qs})
    
    
@csrf_exempt
def upload_trades_to(request, pk):
    status = {
        "Status": MyConstants.STATUS_DELETED
    }
    
#    print "Method %s" % request.get_method()
    if request.POST:
        print "POSTed..."
#        status["Status"] = MyConstants.STATUS_APPROVED
        return HttpResponse( simplejson.dumps(status) )
    return render_to_response("ajax/uploadtradesto.html", context_instance = RequestContext(request))
#    return HttpResponse( simplejson.dumps(status) )

    